import time
time_start=time.time()
from math import sqrt
memo={1:2,2:3}
def isprime(y):
    x=int(sqrt(y))
    if y==1:
        return False
    elif y<4:
        return True
    elif y%2==0:
        return False
    elif y<9:
        return True
    elif y%3==0:
        return False
    else:
        f=5## y % 2 3 5!=0
        while f<=x:
            if y%f==0:
                return False
            if y%(f+2)==0:
                return False
            f=f+6## if y is prime y=6k+/-1 7=6*1+1 then y mod all primefactors
        else:
            return True
x=5
i=3
while 1:
   if isprime(x):
       memo[i]=x
       i=i+1
   x=x+2
   if x>2000000:break
sum=0
for i in memo:
    sum=sum+memo[i]
print sum
end_time=time.time()
print end_time-time_start
